<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
  Created by IntelliJ IDEA.
  User: Zhang
  Date: 2022/2/25
  Time: 18:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Jar列表</title>
</head>
<body>

    <table border="1px" style="text-align: center" align="center" >
      <a href="${pageContext.request.contextPath}/upload.jsp">上传jar包</a><br/>
      <a href="${pageContext.request.contextPath}/inload.jsp">导入</a><br/>
      <a href="${pageContext.request.contextPath}/jar/outDownMvc.do">导出</a><br/>
      <h1 align="center">Jar管理系统</h1>

      <thead>
      <div align="center">
          <form action="${pageContext.request.contextPath}/jar/selectAllJarByPageMvc.do" method="post">
              名称：<input type="text" name="nameSearch">
              <input type="submit" value="搜索">
          </form>
      </div>
      <form action="${pageContext.request.contextPath}/jar/deleteJarsMvc.do" method="post">

            <c:if test="${sessionScope.user!=null}">
                <th><input type="submit" value="删除选中"></th>
            </c:if>

          <th>ID</th>
          <th>jar</th>
          <th>size</th>
          <th>description</th>
            <c:if test="${sessionScope.user!=null}">
          <th>fileName</th>
            </c:if>
<%--          <th>操作</th>--%>
          <th>下载链接</th>
      </thead>

      <tbody>
      <c:forEach items="${requestScope.jarPageInfo.list}" var="jar">
        <tr>
            <c:if test="${sessionScope.user!=null}">
          <td><input type="checkbox" name="ids" value="${jar.id}"></td>
            </c:if>
            </form>
          <td>${jar.id}</td>
          <td>${jar.name}</td>
          <td>${jar.size}</td>
            <td>${jar.description}</td>
            <c:if test="${sessionScope.user!=null}">
          <td>${jar.fileName}</td>
            </c:if>
<%--          <td><a href="${pageContext.request.contextPath}/jar/selectJarByIdMvc.do?id=${jar.id}">修改</a></td>--%>
          <td><a href="${pageContext.request.contextPath}/jar/downloadJarMvc.do?nameOld=${jar.name}&fileUUIDName=${jar.fileName}">点击下载</a></td>
        </tr>
      </c:forEach>
      </tbody>
    </table>

    <div class="dataTables_info" id="DataTables_info" align="center">当前是第${jarPageInfo.pageNum}页 ，共${jarPageInfo.pages}页</div>
    <div class="dataTables_paginate" id="DataTables_paginate" align="center">
      <c:if test="${requestScope.jarPageInfo.hasPreviousPage}">
        <a class="paginate_button" id="previous" href="${pageContext.request.contextPath}/jar/selectAllJarByPageMvc.do?curPageStr=${requestScope.jarPageInfo.prePage}">上一页</a>
      </c:if>
      <c:if test="${requestScope.jarPageInfo.hasNextPage}">
        <a class="paginate_button" id="next" href="${pageContext.request.contextPath}/jar/selectAllJarByPageMvc.do?curPageStr=${requestScope.jarPageInfo.nextPage}">下一页</a>
      </c:if>
    </div>
    </form>
</body>
</html>
